import request from '@/utils/request'

// 获取考试信息
export function start(data) {
  return request({
    url: '/app-api/exam/exam/start',
    method: 'post',
		data:data
  })
}

//根据考试ID查询试卷信息
export function getExamination(data) {
  return request({
    url: '/app-api/exam/exam/getExaminationById',
    method: 'get',
		data:data
  })
}

//查询题目和答题
export function subjectAnswer(data) {
  return request({
    url: '/app-api/exam/exam/subjectAnswer',
    method: 'get',
		data:data
  })
}


//根据考试id查询题目id列表
export function getSubjectIds(examinationId) {
  return request({
    url: '/app-api/exam/exam/' + examinationId + '/subjectIds',
    method: 'get'
  })
}

//根据考试id查询题目id列表
export function saveAndNext(nextType,nextSubjectId,nextSubjectType,data) {
	let url = '/app-api/exam/answer/anonymousUser/saveAndNext?nextType='+ nextType
	if(nextSubjectId != null){
		url = url + '&nextSubjectId=' + nextSubjectId
	}
	if(nextSubjectType != null){
		url = url +'&nextSubjectType=' + nextSubjectType
	}
  return request({
    url: url,
    method: 'post',
		data:data
  })
}


//提交试卷
export function submit(data) {
  return request({
    url: '/app-api/exam/answer/submit',
    method: 'post',
		data:data
  })
}


//获取考试记录
export function getExamRecord(data) {
  return request({
    url: '/app-api/exam/exam/examRecordPage',
    method: 'get',
		data:data
  })
}
//获取考试记录条数
export function getExamTypeCount(data) {
  return request({
    url: '/app-api/exam/exam/getExamTypeCount',
    method: 'get',
		data:data
  })
}
//获取考试记录
export function getPassExamByStudentId(data) {
  return request({
    url: '/app-api/exam/exam/getPassExamByStudentId',
    method: 'get',
		data:data
  })
}


//获取考试详情
export function getExamDetail(id) {
  return request({
    url: '/app-api/exam/exam/' + id + '/details',
    method: 'get'
  })
}

export function getExamOne(id) {
  return request({
    url: '/app-api/exam/activity/queryExamOneByActivityId?activityId=' + id,
    method: 'get'
  })
}


//根据学生id查询考生相关考试信息
export function getStudentExamCount(data) {
  return request({
    url: '/app-api/exam/exam/getStudentExamCount',
    method: 'get',
		data:data
  })
}

//根据学生id查询考生错题记录
export function findErrorAnswer(data) {
  return request({
    url: '/app-api/exam/exam/findErrorAnswer',
    method: 'get',
		data:data
  })
}
//获取试卷分页
export function getExaminationPage(data) {
  return request({
    url: '/admin-api/exam/examination/page',
    method: 'get',
		data:data
  })
}

//获取考试记录分页
export function getRecordPage(data) {
  return request({
    url: '/admin-api/exam/examination-record/page',
    method: 'get',
		data:data
  })
}
//获取选择题分页
export function getQuestionList(data) {
  return request({
    url: '/admin-api/exam/subject-choices/page',
    method: 'get',
		data:data
  })
}
//根据id获取试卷
export function getExaminationById(data) {
  return request({
    url: '/admin-api/exam/examination/get',
    method: 'get',
		data:data
  })
}

//修改试卷信息
export function updateExamination(data) {
  return request({
    url: '/admin-api/exam/examination/update',
    method: 'post',
		data:data
  })
}
//创建新的试卷
export function createExamination(data) {
  return request({
    url: '/admin-api/exam/examination/create',
    method: 'post',
		data:data
  })
}
//删除试卷
export function delExamination(id) {
  return request({
    url: '/admin-api/exam/examination/delete?id=' + id,
    method: 'delete',
  })
}